import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Index",
    meta: {
      requireAuth: true,
    },
    component: () => import("@/views/index"),
    redirect: "/DeviceScreen",
    children: [
      {
        path: "/DeviceScreen",
        name: "DeviceScreen",
        component: () => import("@/views/DeviceScreen/index"),
      },
      {
        path: "/DeviceMap",
        name: "DeviceMap",
        component: () => import("@/views/DeviceMap/index"),
      },
      {
        path: "/DeviceManage",
        name: "DeviceManage",
        component: () => import("@/views/DeviceManage/index"),
      },
      {
        path: "/WarningSystem",
        name: "WarningSystem",
        component: () => import("@/views/WarningSystem/index"),
      },
      {
        path: "/DeviceDetail",
        name: "DeviceDetail",
        component: () => import("@/views/DeviceDetail/index"),
      },
      {
        path: "/MapDriveRoute",
        name: "MapDriveRoute",
        component: () => import("@/views/MapDriveRoute/index"),
      },
      {
        path: "/DataReport",
        name: "DataReport",
        component: () => import("@/views/DataReport/index"),
      }
    ]
  },
  {
    path: "/login",
    name: "Login",
    component: () => import("../views/Login/login.vue"),
  },
  {
    path: "*",
    component: () => import("../views/NotFound.vue"),
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
